//! \file file.hpp
//! \brief Purewell Library Directory Header
//! \author Yubin Lim (purewell@gmail.com)
//! \since 2008-11-07

#ifndef __PWHDR_DIRECTORY_HPP__
#define __PWHDR_DIRECTORY_HPP__

#include <string>
#include <list>

namespace purewell
{

//! \brief Directory class.
class PWDirectory
{
public:
	//! \brief Directory entry container.
	typedef std::list<std::string>		entry_cont;
	//! \brief Directory entry iterator.
	typedef entry_cont::iterator		entry_itr;
	//! \brief Directory entry constant iterator.
	typedef entry_cont::const_iterator	entry_citr;

public:
	//! \brief Get all entries of directory.
	//! \param[out] cnt Entry container.
	//! \param[in] resetpos Reset position.
	//! \return On success, true.
	bool getAllEntries(entry_cont& cnt, bool resetpos = true);

	//! \brief Get entry name of directory.
	//! \param[out] done Check the end of directory entry.
	//! \param[out] name Entry name.
	//! \return On success, true.
	bool getEntry(bool& done, std::string& name);

	//! \brief Reset position.
	void resetPosition(void);

public:
	//! \brief Create directory entry reader object.
	//! \param[in] path Path to read.
	//! \return On success, directory object pointer or NULL.
	static PWDirectory* create(const char* path);

	//! \brief Release directory entry reader object.
	//! \param[in] obj Directory object to release.
	static void release(PWDirectory* obj);

private:
	explicit PWDirectory(const char* path);
	virtual ~PWDirectory();
	PWDirectory& operator = (const PWDirectory&) { return *this; }

private:
	void* m_pData;
};

};//namespace purewell

#endif//!__PWHDR_DIRECTORY_HPP__

